import i18n from '@/utils/lang';
const globali18n:any = i18n.global;

export const enumsTypes:any = {
  // 资金记录类型
  capitalRecordType: {
    "": "Transaction.All",
    "-1": "Transaction.ExchangeRate",
    "1": "Transaction.text01",
    "2": "Transaction.text02",
    "3": "Transaction.text03",
    "4": "Transaction.text25",
    "5": "Transaction.text26",
    "6": "Transaction.Rebate",
    "7": "Transaction.VIPReward",
    "8": "Transaction.Recharge",
    "9": "Transaction.Withdrow",
    "10": "Popularize.Bet",
    "11": "Transaction.text23",
    "12": "Transaction.text24",
    "13": "Transaction.text04",
    "14": "Transaction.text05",
    "15": "Transaction.text27",
    "16": "Transaction.text06",
    "17": "Transaction.text28",
    "18": "Transaction.text07",
    "19": "Transaction.text08",
    "20": "Transaction.text09",
    "21": "Transaction.text10",
    "30": "Transaction.text11",
    "33": "Transaction.text29",
    "34": "Transaction.text30",
    "35": "Transaction.text12",
    "36": "Transaction.text13",
    "39": "Transaction.text31",
    "40": "Transaction.text32",
    "41": "Transaction.text14",
    "42": "Transaction.text15",
    "43": "Transaction.text16",
    "44": "Transaction.text17",
    "45": "Transaction.text18",
    "46": "Transaction.text19",
    "47": "Transaction.text20",
    "48": "Transaction.text21",
    "49": "Transaction.text22",
  },
  // 资金记录状态
  capitalRecordStatus: {
    "": "Transaction.All",
    "0": "Transaction.UnAudit",
    "1": "Transaction.Agree",
    "2": "Transaction.text33",
    "5": "Transaction.UnPay",
    "6": "Transaction.PayOverTime",
    "7": "Transaction.WaitPay",
    "3": "Transaction.PaySuccess",
    "4": "Transaction.PayFail",
    "8": "Transaction.text05",
    "9": "lotteryRecord.text43",
  },
  // 投注记录时间状态
  bettingRecordTimeType: {
    "1": "BetRecord.BettingTime",
    "2": "BetRecord.PayoutTime",
  },
  // 投注记录状态
  bettingRecordStatus: {
    "3": "BetRecord.All",
    "0": "BetRecord.PendingSettlement",
    "1": "BetRecord.Settled",
  },
  // 游戏类型
  gamesType: {
    '0': "home.Originals",
    '1': "home.Slots",
    '5': "home.title4",
    '6': "home.title5",
    '10': "home.Sport",
  },
  // 投注记录显示类型
  bettingsType: {
    '0': "BetRecord.PendingSettlement",
    '1': "BetRecord.Settled",
    '2': "BetRecord.drawback",
  },
  // 会员返水状态
  memberRebateStatus: {
    "": "Rebate.all",
    "0": "Rebate.unaccalimed",
    "1": "Rebate.received",
  },
  // 资金记录类型
  accessRecordType: {
    "1":"Transaction.deposit",
    "2":"Transaction.withdraw"
  },
  // 资金记录状态
  accessRecordStatus: {
    '': "Transaction.All",
    '0': "Transaction.UnAudit",
    '1': "Transaction.Agree",
    '2': "Transaction.text33",
    '5': "Transaction.UnPay",
    '6': "Transaction.PayOverTime",
    '7': "Transaction.WaitPay",
    '3': "Transaction.PaySuccess",
    '4': "Transaction.PayFail",
    '8': "WALLET.text05",
    '9': "lotteryRecord.text43",
  },
  // 救援金状态
  rescueFundsStatus: {
    '': "Rebate.all",
    '1': "Activity.status0",
    '2': "Activity.status1",
  },
  lotteryRecordType: {
    '1': "lotteryRecord.text39",
    '2': "lotteryRecord.text40",
    '4': "lotteryRecord.text41",
  },
  lotteryRecordStatus: {
    '1': "lotteryRecord.text42",
    '2': "lotteryRecord.text43",
    '3': "lotteryRecord.text44",
  },
};


export const getEnumValue = (key?: string, val?: any) => {
  if(key){
    if(val){
      return enumsTypes[key][val];
    }else{
      return enumsTypes[key];
    }
  }else{
    return enumsTypes;
  }
}

export const getEnumOptions = (key: string) => {
  const res:any = [];
  for(let k in enumsTypes[key]){
    res.push({
      label: globali18n.t(enumsTypes[key][k]),
      value: k,
      active: k
    });
  }
  return res.sort((a:any, b:any)=>a.value === '' ? -99999 : a.value - b.value);
}
